POLYTROPIC_EXP
Overview
Calculate polytropic exponent or polytropic efficiency for compression.
Excel Usage
=POLYTROPIC_EXP(k_isentropic, eta_poly)
k_isentropic(float, required): Isentropic exponent of the gas (Cp/Cv) [-]eta_poly(float, required): Polytropic efficiency of the process [-]
Returns (float): Polytropic exponent calculated from isentropic exponent and polytropic efficiency [-]
Examples
Example 1: Air with 78% polytropic efficiency
Inputs:
| k_isentropic | eta_poly |
|---|---|
| 1.4 | 0.78 |
Excel formula:
=POLYTROPIC_EXP(1.4, 0.78)
Expected output:
1.5780346820809246
Example 2: Air with 85% polytropic efficiency
Inputs:
| k_isentropic | eta_poly |
|---|---|
| 1.4 | 0.85 |
Excel formula:
=POLYTROPIC_EXP(1.4, 0.85)
Expected output:
1.5063291139240504
Example 3: Methane (k=1.3) with 80% efficiency
Inputs:
| k_isentropic | eta_poly |
|---|---|
| 1.3 | 0.8 |
Excel formula:
=POLYTROPIC_EXP(1.3, 0.8)
Expected output:
1.4054054054054055
Example 4: High efficiency at 95%
Inputs:
| k_isentropic | eta_poly |
|---|---|
| 1.4 | 0.95 |
Excel formula:
=POLYTROPIC_EXP(1.4, 0.95)
Expected output:
1.4301075268817203
Python Code
import micropip
await micropip.install(["fluids"])
from fluids.compressible import polytropic_exponent as fluids_poly_exp
def polytropic_exp(k_isentropic, eta_poly):
"""
Calculate polytropic exponent or polytropic efficiency for compression.
See: https://fluids.readthedocs.io/fluids.compressible.html#fluids.compressible.polytropic_exponent
This example function is provided as-is without any representation of accuracy.
Args:
k_isentropic (float): Isentropic exponent of the gas (Cp/Cv) [-]
eta_poly (float): Polytropic efficiency of the process [-]
Returns:
float: Polytropic exponent calculated from isentropic exponent and polytropic efficiency [-]
"""
# Validate and convert inputs
try:
k_isentropic = float(k_isentropic)
except (ValueError, TypeError):
return "Invalid input: k_isentropic must be a number."
try:
eta_poly = float(eta_poly)
except (ValueError, TypeError):
return "Invalid input: eta_poly must be a number."
# Validation
if k_isentropic <= 1:
return "Invalid input: k_isentropic must be greater than 1."
if eta_poly <= 0 or eta_poly > 1:
return "Invalid input: eta_poly must be between 0 and 1."
try:
result = fluids_poly_exp(k=k_isentropic, eta_p=eta_poly)
return float(result)
except Exception as e:
return f"Error: Failed to compute polytropic exponent: {str(e)}"